package user;

import book.BookList;
import operation.IOperation;

public abstract class User {
    //用户名
    private String username;

    //支持的操作类型集合
    protected IOperation[] operations;

    public User(String username) {
        this.username = username;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    //打印菜单类 交给下面的类实现
    public abstract int menu();

    //用户作出对应的操作
    public void operate(int choice, BookList bookList) {
        //获取到对应的操作对象
        IOperation operation = operations[choice];
        operation.work(bookList);
    }
}
